﻿using System;
using MotoreDataBase;

namespace MotoreDataBase
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
    public class Nome : Attribute
    {
        private string nome;
        
        public Nome(string nome)
        {
            this.nome = nome;
        }
        
        public override string ToString()
        {
            return this.nome;
        }

    }

    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
    public class NonQuery : Attribute
    {
        private string query;
        private string nome;

        public NonQuery(string nome, string query)
        {
            this.nome = nome;
            this.query = query;
        }

        public override string ToString()
        {
            return this.query;
        }

        public string Nome { get { return this.nome; } }
        
    }

    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class)]
    public class TableDefinition : Attribute
    {
        public TipoDatiDb type { get; private set; }
        public int length { get; private set; }
        public bool allowNull { get; private set; }
        public bool autoIncrement { get; private set; }
        public bool pK { get; private set; }

        public TableDefinition(TipoDatiDb type, int length = 0, bool allowNull = true, bool pK = false, bool autoIncrement = false)
        {
            this.type = type;
            this.length = length;
            this.allowNull = allowNull;
            this.autoIncrement = autoIncrement;
            this.pK = pK;
        }
        
    }


}